import Vue from 'vue'
import './assets/css/global.css'
import {Pagination,Tabs,TabPane,Carousel,CarouselItem} from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import './assets/css/element-#7A4028/index.css'
import App from './App.vue'
import router from './router'
import store from './store'



Vue.use(Pagination)
Vue.use(Tabs)
Vue.use(TabPane)
Vue.use(Carousel)
Vue.use(CarouselItem)



import axios from 'axios'
axios.defaults.baseURL='http://fys.xhhos.com/api/'

Vue.config.productionTip = false
Vue.prototype.$axios = axios;

router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
      document.title = to.meta.title
  }
  next()
})

Vue.filter('dateFormat', function (originVal) {
  const dt = new Date(originVal)

  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')

  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')

  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})


Vue.filter('dateFormat2', function (originVal) {
  const dt = new Date(originVal)

  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')

  const weekDay = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; 
  const myDate = new Date(Date.parse(dt)); 
  const week=weekDay[myDate.getDay()];
  
  return `${y}-${m}-${d} ${week} `
})

Vue.filter('dateFormat3', function (originVal) {
  const dt = new Date(originVal)

  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')
  
  return `${y}-${m}-${d}`
})
// import $ from 'jquery'
// Vue.prototype.JQ = $

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
